#include"Meeting.h" 

// default CTOR
Meeting::Meeting(const vector<string>& part,const string& subj,const string& day, int sHour, int sMin, 
	                                                                  int eHour, int eMin) 
{
	meetParticipators = part;
	meetSubject = subj;
	weekDay = day;
	startHour = sHour;
	startMinute = sMin;
	endHour = eHour;
	endMinute = eMin;
}

// print out meeting data
void Meeting::printOut()const
{
	cout << "| "<<setfill('0') << setw(2) << right << startHour << ":"  <<setw(2) << startMinute << "-";
	cout  << setw(2)<< endHour << ":"  << setw(2)<< endMinute <<setfill(' ')<<setw(3) << right<<"| "  
		<< setw(19) <<left <<meetSubject << "| ";
	int j = 0;
	
	for( int i=0 ; i<(int)meetParticipators.size() ; i++ )
	{
		 j += (meetParticipators[i].size()+1);
		cout << meetParticipators[i] << " ";
	} 
	
	cout <<setw(28-j)<<right<< "| " << endl;
	
	for (int i=0; i<64; i++)
		cout << "-";
	cout << endl;
}

// operator== overloading
bool Meeting::operator==(const Meeting& meet) const
{
	int sValue1 = startHour*60 + startMinute;
	int eValue1 = endHour*60 + endMinute;
	
	int sValue2 = (meet.startHour)*60 + meet.startMinute;
	int eValue2 = (meet.endHour)*60 + meet.endMinute;

	return ((weekDay == meet.weekDay) && ((sValue1-eValue2) < 0) && ((sValue2-eValue1) < 0));
}

// operator< overloading
bool Meeting::operator<(const Meeting& meet) const
{
	int sValue1 = startHour*60 + startMinute;
	int sValue2 = (meet.startHour)*60 + meet.startMinute;

	return (sValue1<sValue2);	
}


//getter for meet Subject
const string& Meeting::getmeetSubject() const
{
	return meetSubject;
}

//getter for meetParticipators
const vector<string>& Meeting::getmeetParticipators() const
{
	return meetParticipators;
}
//getter for week day
const string& Meeting::getWeekDay() const
{
	return weekDay;
}

//getter for start Hour
int Meeting::getStartHour() const
{
	return startHour;
}

//getter for start Minute
int Meeting::getStartMinute() const
{
	return startMinute;
}

//getter for end Hour
int Meeting::getEndHour() const
{
	return endHour;
}

//getter for end Minute
int Meeting::getEndMinute() const
{
	return endMinute;
}

//setter for start Hour
void Meeting::setStartHour(int h)
{
	startHour = h;
}

//setter for start Minute
void Meeting::setStartMinute(int m)
{
	startMinute = m;
}

//setter for end Hour
void Meeting::setEndHour(int h)
{
	endHour = h;
}

//setter for end Minute
void Meeting::setEndMinute(int m)
{
	endMinute = m;
}

//setter for day
void Meeting::setDay(string day)
{
	weekDay = day;
}

// DTOR
Meeting::~Meeting()
{

}